<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Timeline记录内存</title>
</head>
<body>
    <button id='btn'>Add</button>
    <script>
        // 1. 创建大量DOM节点模拟内存消耗
        // 2. DOM节点不够,数组配合其他方法, 形成非常长的字符串,模拟内存消耗
            
        const arrList = []
        function test(){
            for(let i = 0; i < 100000;i++){
                document.body.appendChild(document.createElement('p'))
            }
            arrList.push(new Array(1000000).join('x'))
        }
        document.getElementById('btn').addEventListener('click', test)
    </script>
</body>
</html>